import * as actionTypes from './constans'
import {getactors,getmoviesRequest} from '@/api/request'

export const changeactorslist = (data) => ({
    type:actionTypes.CHANGE_ACTORS,
    data
})
export const getactorslist = () => {
    return (dispatch) => {
            getactors()
            .then(item => {
                // console.log(item.data, '////')
                const action = changeactorslist(item.data);
                dispatch(action)
            })
    }
}
export const changemovienum = (data) => ({
    type: actionTypes.CHNAGE_MOVIES_NUM,
    data: data
})
export const checkmovie = (id) => ({
    type: actionTypes.CHECK_MOVIE,
    data: id
})
export const changemovie = (data) => ({
    type:actionTypes.CHANGE_MOVIE_LIST,
    data
})
export const getmovies = () => {
    return (dispatch) => {
        // console.log('12')
            getmoviesRequest()
            .then(item => {
                // console.log(item.data, '////')
                const action = changemovie(item.data);
                dispatch(action)
            })
    }
}
